<template>
  <default-layout>
    <header-close text="我的继续教育" slot="header"></header-close>
    <div class="form-list" slot="main">
      <div class="form-list-item">
        <span class="label">姓名：</span>
        <span class="content">{{info.aac003}}</span>
      </div>
      <div class="form-list-item">
        <span class="label">身份证号：</span>
        <span class="content">{{info.aac002}}</span>
      </div>
      <div class="form-list-item">
        <span class="label">工作单位：</span>
        <span class="content">{{info.company}}</span>
      </div>
      <div class="form-list-item">
        <span class="label">报名课程：</span>
        <span class="content">{{info.course}}</span>
      </div>
      <div class="form-list-item">
        <span class="label">报名年份：</span>
        <span class="content">{{info.learnYear}}</span>
      </div>
      <div class="form-list-item">
        <span class="label">学习状态：</span>
        <span class="content" :class="{danger: Number(info.learnStatusCode) === 0}">{{info.learnStatus}}</span>
      </div>
      <div class="form-list-item">
        <span class="label">报名序号：</span>
        <span class="content">{{info.serialNumber || '--'}}</span>
      </div>
    </div>
    <div class="next" slot="footer">
      <mt-button
        type="primary"
        size="large"
        @click="apply"
        v-if="Number(info.learnStatusCode) === 2">下载合格证明</mt-button>
      <mt-button
        type="primary"
        size="large"
        @click="go"
        v-else
        :disabled="Number(info.learnStatusCode) !== 1">上传考试成绩</mt-button>
    </div>
  </default-layout>
</template>
<script>
  import HeaderClose from '../../../components/header-close/header-close.vue'
  import DefaultLayout from '../../../layouts/default-layout/default-layout'
  import {download} from '../../../common/js/util'

  export default {
    components: {DefaultLayout, HeaderClose},
    data() {
      return {
        info: {}
      }
    },
    methods: {
      go() {
        this.$router.push({
          name: 'qualifiedUpload',
          query: this.$route.query
        })
      },
      getInfo() {
        this.$post('/admin/person/sapi/education/continuing/get/detail/info', {
          applyId: this.$route.query.applyId,
          yearId: this.$route.query.yearId
        }).then(res => {
          this.info = res.data
        })
      },
      apply() {
        // 下载合格证明
        download(this.$getImg(decodeURIComponent(this.$route.query.handle)))
      }
    },
    created() {
      this.getInfo()
    }
  }
</script>
<style lang="scss" scoped>
  @import "../../../common/style/_variable.scss";
  .danger{
    color: $danger !important;
  }
</style>
